home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / hardware / formatsfs / formatsfs next >
Text File  |  1999-12-06  |  11KB  |  319 lines

  1. /* $VER: FormatSFS 2.2 (27.11.99) */
  2.  
  3. /*---Do Not Alter these 6 lines By Hand---*/
  4. HDToolBox='Workbench:Tools/HDISK/HDToolBox'
  5. NewName='Empty'
  6. SFScomms='C:'
  7. /*----------------------------------------*/
  8.  
  9. tSFScomms=SFScomms
  10. tHDToolBox=HDToolBox
  11. tNewName=NewName
  12.  
  13. name=NewName
  14. mes='Please Select a Device'
  15.  
  16. voln=0; cs=0; nr=0; sr=0; tc=1
  17.  
  18. OPTIONS RESULTS
  19.  
  20. if ~show('l','rexxsupport.library') then do; addedlib=1;call addlib('rexxsupport.library',0,-30,0); end
  21. ib=showlist(l,'intuition.library',,a)
  22. call forbid; scrA=next(ib,56); screen=word(IMPORT(next(scrA,26)),1); call permit
  23.  
  24. parse source . . . progname .
  25. call getdevs()
  26. call gogui()
  27. call sethelp()
  28.  
  29. do while ~eof(pip)
  30. call top('continue')
  31. in= readln(pip)
  32. parse var in in1 in2 in3 in4 .
  33.  
  34. if in1='iconify' then top('id 0 s '64-(in2*32))
  35. if in1='gadget' then call gadget()
  36. if in1='help' then call help()
  37.  
  38. end
  39.  
  40. call close(pip)
  41. exit
  42.  
  43. gogui:
  44.  
  45. call open(pip,'awnpipe:sfsformat/xc')
  46. call top('"FormatSFS By Brucey" app cg db dg ig it "FormatSFS" ii "'progname'" sw fw fh m a sk h ps 'screen'')
  47. call top('menu gt "Info|About FormatSFS|$!$VER: ''FormatSFS'' 2.2 (27.11.99)|$!Bruce Steers <bsteers@btinternet.com>|$!http://www.btinternet.com/~bsteers/|-|About AWNPipe|$!The ''Excellent'' AWebNewsPipe|$!Bill Parker <wparker@amitrix.com>|$!http://web.ukonline.co.uk/awnpipe/"')
  48.         ct=top('clicktab ctl "Program|Prefs"')
  49.     call top('layout page 'ct' b 7 so v gt "Format SFS Tool"')
  50.         call top('layout v b 5 sw weih 0')
  51.           call top('space'); call top('space');
  52.         mesg=top('textfield b 0 ro cj gt "'mes'" minh 20')
  53.         call top('le')
  54.         call top('layout b 7 si so')
  55.         call top('label gt "*n New Name: " weiw 0')
  56.         namsg=top('string tc cj dis=1 gt "'name'"')
  57.         dng=top('button tc dis=1 gt "_Same" weiw 0')
  58.         call top('le')
  59.         call top('layout b 5 v si so')
  60.             call top('layout b 0')
  61.             call top('space')
  62.             csg=top('checkbox dis=1 gt "_CaseSensitive"')
  63.             hdtg=top('button gt "_HDT"')
  64.             call top('space')
  65.             xtrag=top('chooser tc dis 1 weiw 0 gt "x" cl "SFScheck|SFSdefragmentGUI|SFSquery"')
  66.             call top('space')
  67.             call top('le')
  68.             call top('layout b 0')
  69.             rcg=top('chooser tc dis=1 weiw 0 pu cl "Hide Recycled|Show Recycled|No Recycled"')
  70.             call top('space')
  71.             volg=top('chooser tc 'cl'')
  72.             call top('space')
  73.             call top('le')
  74.         call top('le')
  75.     call top('space')
  76.         call top('layout b 4 si so')
  77.         fmtg=top('button tc dis=1 gt "_Format"')
  78.         qitg=top('button tc gt "_Quit" c')
  79.         call top('le')
  80.     call top('le')
  81.     call top('layout page 'ct' b 7 so v gt "Format SFS Setings"')
  82.         call top('layout v b 5 gt "Paths"')
  83.             call top('layout b 0 so')
  84.             call top('label gt "*n SFS Commands "')
  85.             sfscg=top('getfile i fn "'SFScomms'" gt "SFS Commands Dir"')
  86.             call top('le')
  87.             call top('layout b 0 so')
  88.             call top('label gt "*n HDToolBox "')
  89.             hdtpg=top('getfile i fn "'HDToolBox'" gt "Find HDToolBox"')
  90.             call top('le')
  91.         call top('space')
  92.         call top('le')
  93.         call top('layout b 7 so si')
  94.         call top('label gt "*n Default new Name " weiw 0')
  95.          nnamg=top('string tc cj gt "'newname'"')
  96.         call top('le')
  97.         call top('layout b 4 si so')
  98.         spg=top('button tc gt "_Save"')
  99.         upg=top('button tc gt "_Use"')
  100.         lpg=top('button tc gt "_Re-Load"')
  101.         call top('le')
  102.     call top('le')
  103.  
  104. call top('open')
  105. cis=1
  106. return
  107.  
  108.  
  109. /*--------------- main page gadgets ----------------*/
  110.  
  111. gadget:
  112. select
  113. when in2=ct then do; cis=in3+1 ; hlp.ct='Goto 'word('Prefs Main',cis)' Page'; end
  114. when in2==namsg then name=substr(in,10);
  115.  
  116. when in2==dng then do;
  117. if voln==0 then return;
  118. name=strip(voln,,':');
  119. call top('id 'namsg' gt "'name'" ref');
  120.  
  121.   end
  122.  when in2==volg then do;
  123.  if voln==0 then call top('id 0 dis=0 ref');
  124.  in3=in3+1; voln=word(devs,in3*2);
  125.  name=NewName
  126.  call top('id 'volg' gt "'voln'" ref');
  127.  call top('id 'mesg' gt " Selected -> 'voln'" ref');
  128.  call top('id 'namsg' gt "'name'" ref');
  129.  end
  130.  
  131. when in2==hdtg then if req('formatSFS',' Going to Run *n 'HDToolBox' ','_OK','_Cancel')==1 then call gohdt()
  132. when in2=xtrag then call xfunc()
  133. when in2==csg then cs=in3
  134. when in2==rcg then rcm=in3;
  135. when in2==tcg then tc=in3
  136. /*when in2==qitg then address command 'run rx 'progname''*/
  137. when in2==fmtg then call formit()
  138.  
  139. /*--------------- prefs page gadgets ----------------*/
  140. when in2=sfscg then tSFScomms=strip(in4,,'"')
  141. when in2=hdtpg then tHDToolBox=strip(in4,,'"')
  142. when in2=nnamg then tNewName=strip(in3)
  143.  
  144. when in2=spg then do; SFScomms=tSFScomms; HDToolBox=tHDToolBox; NewName=tNewName; call saveprefs();call top('id 'ct' s 0 ref'); end
  145. when in2=lpg then call loadprefs()
  146. when in2=upg then do; SFScomms=tSFScomms; HDToolBox=tHDToolBox; NewName=tNewName;call top('id 'namsg' gt "'NewName'"'); name=NewName; call top('id 'ct' s 0 ref'); end
  147.  
  148. otherwise /*say in*/ nop
  149. end
  150. return
  151.  
  152. help:
  153. if in2<1 then in2=0
  154. tx=hlp.in2
  155. call top('id 0 s 8 gt "'tx'"')
  156. return
  157.  
  158. xfunc:
  159. if voln==0 then do; call req('Error',' Sorry but NO *n Device is Selected ','_Oops'); return; end
  160. call appendir()
  161. if in3==0 then do;if req('formatSFS',' Going to Run SFSCheck on *n Device : 'voln' ','_OK','_Cancel')==2 then return; address command 'run 'SFScomms'SFSCheck 'voln''; return; end
  162. if in3==1 then do;if req('formatSFS',' Going to Run SFSdefragmentGUI on *n Device : 'voln' ','_OK','_Cancel')==2 then return; address command 'run >nil: 'SFScomms'SFSdefragmentGUI 'voln''; return; end
  163. if in3==2 then do;if req('formatSFS',' Going to Run SFSQuery on *n Device : 'voln' ','_OK','_Cancel')==2 then return; address command 'run 'SFScomms'SFSQuery 'voln''; return; end
  164.  
  165.  
  166. return
  167.  
  168. appendir:; lc=substr(SFScomms,length(SFScomms),1); if lc==':'|lc=='/' then return; SFScomms=''SFScomms'/'; return
  169.  
  170. formit:
  171. /*if index(name,' ')~=0 then name='"'name'"'*/
  172. call appendir()
  173. cmd=''SFScomms'SFSFormat DEVICE "'voln'" NAME "'name'"'
  174. if rcm==1 then cmd=''cmd' SHOWRECYCLED'
  175. if rcm==2 then cmd=''cmd' NORECYCLED'
  176. if cs==1 then cmd=''cmd' CASESENSITIVE'
  177.  
  178. if req(' Going to FORMAT !','*n OK TO RUN COMAND *n*n 'cmd' *n','_YES','_NO')==1 then;
  179. address command cmd
  180. return
  181.  
  182. getdevs: ;
  183. call appendir()
  184. address command 'copy clone c:version t:'
  185. address command 'assign devices >t:devlist'
  186. call open(dl,'t:devlist'); call readln(dl); call readln(dl)
  187. devs='"';
  188. OPTIONS FAILAT 25
  189. call pragma('N')
  190.   do while ~eof(dl)
  191.   lin=readln(dl)
  192.     if lin~="" then do
  193.       do yy=1 to words(lin)
  194.       address command 'failat 25' || '0A'X || 't:version >t:ver 'word(lin,yy)':'
  195.       call open(q,'t:ver')
  196.       ln=readln(q);
  197.       call close(q)
  198.       if index(ln,'Smart Filesystem')~=0 then devs=''devs' 'word(lin,yy)': |'
  199.       end
  200.     end
  201.   end
  202. call pragma()
  203. OPTIONS FAILAT 10
  204. call close(dl)
  205. if exists('t:version')==1 then address command 'delete QUIET >nil: t:version'
  206. if exists('t:ver')==1 then address command 'delete QUIET >nil: t:ver'
  207. if exists('t:devlist')==1 then address command 'delete QUIET >nil: t:devlist'
  208.  
  209. nl=0
  210. do x=1 to words(devs);l=length(word(devs,x));if l>nl then nl=l; end
  211. nl=max(nl,6)
  212. devs=''strip(devs,,'|')'"'
  213.  
  214. nl=nl*10;
  215. nl=nl+25;
  216. cl='gt "DEVICE" cl 'devs' minw 'nl''
  217. if devs=='""' then do
  218. cl='gt "No Devices" dis 1 cl "|"';
  219. ans=req('FormatSFS',' FormatSFS has not found any SmartFileSystem *n partitions on you hard drive !!! *n*n as SFSFormat will only work on SFS Partitions *n you should load HDToolBox to setup your HD ','Run _HDToolbox','_Load FormatSFS','_Quit FormatSFS')
  220. if ans==1 then call gohdt()
  221. if ans==3 then exit
  222. end
  223. return
  224.  
  225. gohdt:
  226.  
  227.   if ~exists(HDToolBox) then do;
  228.   req(' Error ..','ERROR...*n Couldn''t find the HDToolBox Program at *n "'HDToolBox'" *n You have to point to HDToolBox *n*n Please Show me where HDToolBox is.. ','_OK');
  229.   address command 'requestfile title "Where''s HDToolBox ?" drawer "sys:tools" >pipe:rqf'
  230.   if RC==5 THEN return
  231.   call open(q,'pipe:rqf');ans=readln(q); call close(q)
  232.   HDToolBox=strip(ans,,'"')
  233.   call saveprefs()
  234.   end
  235. address command 'run >nil: 'HDToolBox'';
  236. if devs='""' then do; if pip~="" then call close(pip);exit;end
  237. return
  238.  
  239. checksfs:
  240. call appendir()
  241.   if ~exists(''SFScomms'SFSFormat') then do;
  242.   req(' Error ..','ERROR...*n Couldn''t find the SFSFormat Program at *n "'SFScomms'" *n You have to point to the Drawer Containing *n SFSFormat , SFSQueery ect.ect. *n*n Please Show me where the SFSCommands Are . ','_OK');
  243.   address command 'requestfile drawersonly title "Where''s HDToolBox ?" drawer "sys:tools" >pipe:rqf'
  244.   if RC==5 THEN return
  245.   call open(q,'pipe:rqf');ans=readln(q); call close(q)
  246.   HDToolBox=strip(ans,,'"')
  247.   call saveprefs()
  248.   end
  249. address command 'run >nil: 'HDToolBox'';
  250. if devs='""' then do; if pip~="" then call close(pip);exit;end
  251. return
  252.  
  253. saveprefs:
  254. parse arg use
  255. call open(ph,progname,'R')
  256. fin=0; ln=0
  257.   do xx=1 while ln~='/*---Do Not Alter these 6 lines By Hand---*/'
  258.   ln=readln(ph)
  259.   end;
  260. call close(ph)
  261. if ~show('l','rexxtricks.library') then do; opa=1; call addlib('rexxtricks.library',0,-30); end
  262.  
  263. s.1='HDToolBox='''HDToolBox''''
  264. s.2='NewName='''NewName''''
  265. s.3='SFScomms='''SFScomms''''
  266. s.0=3
  267. call writelines(progname,xx,s,'R')
  268. if opa==1 then call remlib('rexxtricks.library')
  269. call top('id 'namsg' gt "'NewName'" ref'); name=NewName
  270.  
  271. return
  272.  
  273.  
  274.  
  275. loadprefs:
  276. call open(ph,progname)
  277. fin==0;
  278. do until fin==-1
  279. lin=readln(ph)
  280. if lin='/*---Do Not Alter these 6 lines By Hand---*/' then do
  281. lin=leadln(ph); parse var lin . '=''' HDToolBox ''''
  282. lin=leadln(ph); parse var lin . '=''' NewName ''''
  283. lin=leadln(ph); parse var lin . '=''' SFScomms ''''
  284. fin==-1
  285. end
  286. call close(progname)
  287. call top('id 'sfscg' fn "'SFScomms'" ref')
  288. call top('id 'hdtpg' fn "'HDToolBox'" ref')
  289. call top('id 'nnamg' gt "'NewName'" ref')
  290. call top('id 'namsg' gt "'NewName'"'); name=NewName
  291. return
  292.  
  293. top: ; parse arg out; call writeln(pip,out); res=readln(pip); parse var res res1 res2 . ; if res1='ok' then return(res2); say 'error from: 'out; say '  responce: ' res; exit
  294.  
  295. req: ; parse arg bar,txt,g1,g2,g3,g4,g5,g6,g7 .; if rf~=0 then call close(rf);
  296. call top('id 0 s 256')
  297. call open(rf,'awnpipe:newhtmlreq/xc')
  298. nxt=txt;
  299. p=1; do while p~=0; p=index(nxt,'"',p); if P~=0 then do; nxt=insert('*',nxt,p-1);p=p+2; end; end;
  300. call writeln(rf,'"'bar'" v it "NewHTML" sw dg db a ps 'screen'');
  301. call writeln(rf,'space');
  302. call writeln(rf,'layout b 5');
  303. call writeln(rf,'space');
  304. call writeln(rf,'label so weih 5 weiw 10 gt "*n*n'nxt'"');
  305. call writeln(rf,'space');
  306. call writeln(rf,'le');
  307. call writeln(rf,'layout b 0 si so');
  308. if g1~="" then call writeln(rf,'button gt "'g1'" close');if g2~="" then call writeln(rf,'button gt "'g2'" close');if g3~="" then call writeln(rf,'button gt "'g3'" close');if g4~="" then call writeln(rf,'button gt "'g4'" close');if g5~="" then call writeln(rf,'button gt "'g5'" close');if g6~="" then call writeln(rf,'button gt "'g6'" close');if g7~="" then call writeln(rf,'button gt "'g7'" close');
  309. call writeln(rf,'le');
  310. call writeln(rf,'open');call readln(rf)
  311. do while ~eof(rf); rn=readln(rf); parse var rn rn1 rn2 rn3 rn4 rn5 .;
  312. if rn1=='gadget' then do; call top('id 0 s 512'); return(rn2-2); end; end
  313. call top('id 0 s 512'); return(0)
  314.  
  315. sethelp: ; hlp.ct='Goto Prefs Page'; hlp.namsg='New Volume Name' ; hlp.dng='Set as Device Name'; hlp.csg='Set Case Sensivity'; hlp.hdtg='Run HDToolBox'
  316. hlp.xtrag='Extra SFS Functions'; hlp.rcg='Set .Recycle Mode'; hlp.volg='Device To Operate on'; hlp.fmtg='Start Format'; hlp.mesg='Selected Device'
  317. hlp.qitg='Quit FormatSFS'; hlp.sfscg='Path to SFS Executables'; hlp.hdtpg='Path to HDToolBox'; hlp.nnamg='Default New Name'
  318. hlp.spg='Save Prefs EnvArc:'; hlp.lpg='Reload Prefs'; hlp.upg='Use Prefs Env:'; hlp.0='FormatSFS By Brucey'; return
  319.